<template>
  <div>
    <img :src="item.img_url" alt="" v-for="(item,index) of imgList" :key="index" @click="toGoodsDetail(item.link_url)" mode="widthFix">
  </div>
</template>
<script>
export default {
  data() {
    return {
      imgList:''
    }
  },
  methods: {
    toGoodsDetail(link){
       let pattern=/^\/pages/
        if(pattern.exec(link)){
          this.$currency.navigateTo(link)
        }else{
          wx.navigateTo({url:'/pages/advert/main?url='+link})
        }
      this.$currency.navigateTo(`/pages/goodsDetail/main?id=${link}`)
    },
    async getAdvertList(){
      //获取广告数据
      const res=await this.$request.getData('/other/getAdvertImg',{type:'special_topic'})
      if(res.data.level=='success'){
        this.imgList=res.data.data
      }
    }

  }, 
  onLoad(){
    this.getAdvertList()
  }
}
</script>
<style lang="scss" scoped>
  img{
    width:100%;
    display: block;
  }
</style>
